<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script>
		function count(){
		var a=window.prompt("请输入考试科目数量：");
		var c=0;
		for(var i=1;i<=a;i++){
			var b=window.prompt("请输入第"+i+"门课的成绩！");
			b=parseInt(b);
			window.document.write("你输入的第"+i+"门课成绩为:"+b+"<br />");
			c=parseInt(c);
			c=c+b;
		}
		window.document.write("你输入的总成绩为:"+c);
		}
		</script>
	</head>
	<body>
		<input type="button" value="输入科目数量,统计考试成绩" onclick="count()"/>
	</body>
</html>
